import axios from './axios.js'
import Config from './config'
let service = {
    register(data) {
        console.log(data)
        return axios.get('/login/register', {params: {
            ...data
        }});
    },
    //发送注册验证码接口
    registerCode(data) {
        console.log(data)
        return axios.get('/login/registerCode', {params: {
                ...data
            }});
    },
    //登录接口
    login(data) {
        console.log(data)
        return axios.get('/login/in', {params: {
                ...data
            }});
    },
    //获取用户信息接口
    getUserInfo(data) {
        console.log(data)
        return axios.get('/user/getUserInfo', {params: {
                ...data
            }});
    },
    //更新用户信息接口
    updateUserInfo(data) {
        console.log(data)
        return axios.post('/user/updateUserInfo', {params: {
                ...data
            }});
    },
    uploadFile(data) {
        console.log(data);
        let formData = new FormData();
        formData.append("file", data);
        console.log(formData)
        return axios.post('/user/uploadImg', formData);
    },
    //添加分类
    addClassify(data) {
        console.log(data)
        return axios.get('/type/addType', {params: {
                ...data
            }});
    },
    //获取分类
    getClassify(data) {
        return axios.get('/type/typeList', {params: {
                ...data
            }});
    },
    //修改分类
    updateClassify(data) {
        console.log(data)
        return axios.get('/type/updateType', {params: {
                ...data
            }});
    },
    //删除分类
    deleteClassify(data) {
        console.log(data)
        return axios.get('/type/delType', {params: {
                ...data
            }});
    },
    //上传文章
    addArticle(data) {
        console.log(data)
        return axios.get('/article/add', {params: {
                ...data
            }});
    },
    //根据分类查看文章
    getArticle(data) {
        console.log(data)
        return axios.get('/article/listByType', {params: {
                ...data
            }});
    },
    //文章详情
    getArticleDetail(data) {
        console.log(data)
        return axios.get('/article/getArticleById', {params: {
                ...data
            }});
    },
    //修改文章
    updateArticle(data) {
        console.log(data)
        return axios.get('/article/updateArticle', {params: {
                ...data
            }});
    },
    //首页查询文章
    getArticleList(data) {
        console.log(data)
        return axios.get('/article/list', {params: {
                ...data
            }});
    },
}

export default service